import { defineStore } from 'pinia';
import { ApiRes } from '@/types/data'
import { CheckoutInfo } from '@/types/checkout'
import request from '@/utils/request'
// 结算模块
export default defineStore('checkout', {
  state() {
    return {
      // 结算订单信息
      checkoutInfo: {} as CheckoutInfo
    }
  },
  actions: {
    // 获取结算的订单信息
    async getCheckoutInfo() {
      const res = await request.get<ApiRes<CheckoutInfo>>('/member/order/pre')
      this.checkoutInfo = res.data.result
    }
  }
})